package cn.edu.klmy.spring.security.web.authentication;

import cn.edu.klmy.spring.security.core.userdetails.CourseSystemUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 顾伟
 *         创建日期：13-3-2
 */
public class LoginSuccessHandler implements AuthenticationSuccessHandler {
    @Override
    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
        //CourseSystemUser user = (CourseSystemUser) authentication.getPrincipal();
        //httpServletRequest.getSession().setAttribute("user", user.getUser());
        httpServletResponse.sendRedirect("main");
    }
}
